﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLCH_ANUONG.Forms
{
    public partial class frmDinhMuc : Form
    {
        public frmDinhMuc()
        {
            InitializeComponent();
            string strTag = Convert.ToString(this.Tag);
            clsMain.flexConn.InitForms(strTag, ref fcListView);
            clsMain.flexConn.InitForms(strTag, ref fcButton);
            clsMain.flexConn.InitForms(strTag, ref fctxtCalamviec);
            clsMain.flexConn.InitForms(strTag, ref fctxtLoaiNV);
            clsMain.flexConn.InitForms(strTag, ref fctxtMaso);
            clsMain.flexConn.InitForms(strTag, ref fctxtTienLuong);

        }

        private void frmDinhMuc_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode.Equals(System.Windows.Forms.Keys.Escape))
            {
                this.Visible = false;
            }
        }

        private void fcListView_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                fcButton.ChangeState(FlexControls.flexControls.STATE_UPDATE);
                clsMain.flexConn.AddDataToControll(fcListView.strSelectItemCode, Convert.ToString(this.Tag), clsMain.flexConn.fcConn);
            }
            catch (Exception ex)
            {
                MessageBox.Show("fcButton click\n" + ex.ToString());
            }
        }

        private void fcButton_Click(object sender, EventArgs e)
        {
            try
            {
                clsMain.flexConn.fcButton_Click(Convert.ToString(this.Tag), ref fcButton, clsMain.flexConn.fcConn);
            }
            catch (Exception ex)
            {
                MessageBox.Show("fcButton click\n" + ex.ToString());
            }
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }
    }
}
